using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using FilteredStatistics.Common;
using FilteredStatistics.Controller;
using FilteredStatistics.Data;

namespace FilteredStatistics.View
{
    class RangeWrapperColumnComparer : IComparer<ActivityRangeInfoCache>
    {
        public RangeWrapperColumnComparer(TreeListColumnInfo columnInfo)
        {
            Debug.Assert(columnInfo != null);

            m_SortingColumn = columnInfo;
        }

#region IComparer<RangeWrapper> Members

        public int Compare(ActivityRangeInfoCache x, ActivityRangeInfoCache y)
        {
            IStatisticsProvider provider = m_SortingColumn.Provider as IStatisticsProvider;

            return provider.CompareRanges(m_SortingColumn.Id, (int)m_SortingColumn.Sorting, x, y);
        }

#endregion

        TreeListColumnInfo m_SortingColumn = null;
    }
}
